﻿/*
 * 
 * */

namespace AcctrueWMS.Foundation.Rule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;
    using System.Data;

    public class ModelRuleCollection : InternalDataCollectionBase
    {
        private ArrayList list;
        protected override ArrayList List
        {
            get
            {
                if (list == null)
                    list = new System.Collections.ArrayList();
                return list;
            }
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="modelRule"></param>
        public void Add(ModelRule modelRule)
        {
            List.Add(modelRule);
        }
        /// <summary>
        /// 移除项
        /// </summary>
        /// <param name="modelRule"></param>
        public void Remove(ModelRule modelRule)
        {
            List.Remove(modelRule);
        }
        /// <summary>
        /// 移除指定索引项
        /// </summary>
        /// <param name="index"></param>
        public void RemoveAt(int index)
        {
            List.RemoveAt(index);
        }
        public ModelRule this[string name]
        {
            get
            {
                return List.Cast<ModelRule>().First<ModelRule>(item => item.Name == name);
            }
        }
        public ModelRule this[int index]
        {
            get
            {
                return List[index] as ModelRule;
            }
        }
    }
}
